package cn.edu.csust.coursecard.dao;

import cn.edu.csust.coursecard.dao.entity.Version;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import javax.websocket.server.PathParam;

/**
 * @author zsw
 * @descirption
 * @date 2020/02/16 22:56
 */
@Mapper
public interface VersionDAO {

//	@Select("select top 1 * from version order by version_id desc")
	@Select("select * from version where form = #{form} and flag = #{flag} order by id desc limit 1")
	Version getLastVersion(@Param("form") String form, @Param("flag") Byte flag);

	@Insert("insert into version(apk_path,info,form,flag,update_time) values(#{apkPath},#{info},#{form},#{flag},now())")
	int insertVersion(Version version);

	@Insert("insert into version (apk_path,url,info,form,flag,update_time) values (#{apkPath},#{url},#{info},#{form},#{flag},now())")
	int insertVersionV2(Version version);
}
